import axios from 'axios';
// import {message} from 'antd';

export const request = (url, data={}, method='get') => {
  return new Promise((resolve, reject) => {
    let promise;
    if(method === 'get') {
      promise = axios.get(url, {params: data});
    } else {
      promise = axios.post(url, data);
    }
    promise
      .then(res => resolve(res))
      .catch(err => reject(err));
  })
}
